package com.chezhujie.www.controller;

import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.chezhujie.www.domain.Czjcommodity;
import com.chezhujie.www.domain.Czjtemp;
import com.chezhujie.www.service.CzjcommodityService;
import com.chezhujie.www.service.CzjcommodityimageService;
import com.chezhujie.www.service.CzjtempService;

@RequestMapping("/deleteImg")
@Controller
public class DeleteImgControler extends BaseController{
	
	@Autowired
	private CzjcommodityimageService DeleteImgControler;
	
	
	@Autowired
	private CzjtempService czjtempService;
	
	@RequestMapping("delteCommodity")
	public void delteCommodity(String id,String no,HttpServletResponse response){
	
		
		try {
			Czjtemp czjtemp=new Czjtemp();
				czjtemp.setDataresourceId(id);
			if(no.equals("1")){
				
				czjtemp.setPicPath("");
				czjtempService.updateTemp(czjtemp);
				jsonResult(1, "", "", "", response);
			}else if(no.equals("2")){
				czjtemp.setBackgroundPath("");
				czjtempService.updateTemp(czjtemp);
				jsonResult(1, "", "", "", response);
			}else{
				czjtemp.setSweepImgPath("");
				czjtempService.updateTemp(czjtemp);
				jsonResult(1, "", "", "", response);
			}
		} catch (Exception e) {
			e.printStackTrace();
			jsonResult(0, "147", "", "", response);
		}
		
	}
	
	

}
